<template>
	<view>
		<view class="content_box">
			<view class="pet_list_box">
				<view class="pet" v-for="(item, index) in petfilesList" :key="index"
					>
					<view class="image" @click="getPathTap('/pages/user/editCat/editCat?id='+item.id)">
						<image :src="item.headImgUrl"  mode="aspectFill"></image>
						<view  class="sex" style="background-color: aliceblue;border-radius: 30rpx;">
							<uv-icon name="man" color="#297aff" size="26" v-if="item.sex==1"></uv-icon>
							<uv-icon name="woman" color="#f44c87" size="26" v-else></uv-icon>
						</view>
					</view>
					<view class="info" @click="getPathTap('/pages/user/catList/catImage?id='+item.id)">
						<view class="title">{{item.name||item.name}}</view>
						<view class="box">
							<view class="text">{{item.breed}}</view>
							<uv-icon name="eye" color="#333" size="26" ></uv-icon>
							<!-- <view class="year">{{getYearOld(item.birthday)}}</view> -->
						</view>
					</view>
				</view>
				<view class="pet add">
					<view class="cat" @click="getPathTap('/pages/user/editCat/editCat')">
						<view class="" style="padding: 20rpx;border-radius: 30rpx;">
							<!-- <uv-icon name="plus" color="#ed781b" size="80" ></uv-icon> -->
							<image style="width: 270rpx;height: 220rpx;" src="https://oss.daccf.com/zwnmfe1p572r9r3ycu480/图标/9c23dc67-fa4b-4f20-b96e-3750ab2ee8a7.png"  ></image>
							
						</view>
						<span>添加新猫咪</span>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { getUserPetArchivesList, insertPlugsPetRarchives,delPlugsPetRarchives,updatePlugsPetRarchives,searchPlugsPetRarchivesById,getBusinessInfoList } from '../../../utils/api.js';
	export default {
		data() {
			return {
				petfilesList:[],
				columns:[]
			}
		},
		onShow() {
			this.getList()
		},
		methods: {
			getList(){
				// let data={
				// 	userServiceToken:'CHJII12WGTS2ZGGUH25RD'
				// }
				getUserPetArchivesList().then(res=>{
					if(res.code==200){
						this.petfilesList=res.body.list
					}
				})
			},
			getBusinessInfoList(){
				getBusinessInfoList().then(res => {
					if (res.code == 200) {
						// this.$nextTick(()=>{
							this.columns.push(res.body)
					}
				});
			},
			getPathTap(path){
				uni.navigateTo({
					url:path
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		padding: 20rpx;
		background-color: #f5f5f5;
	}
.content_box {
		width: 100%;
		position: relative;
		z-index: 100;
		border-top-left-radius: 30rpx;
		border-top-right-radius: 30rpx;
		border-radius: 20rpx;

		.pet_list_box {
			width: 100%;
			height: 380rpx;
			white-space: nowrap;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;

			.pet {
				display: inline-block;
				width: 300rpx;
				border-radius: 30rpx;
				overflow: hidden;
				margin-right: 40rpx;
				border: 1px solid #ed781b40;
				box-shadow: 10rpx 10rpx 0 #ed781b30;
				padding: 14rpx 0;
				margin-top: 40rpx;

				.image {
					width: 90%;
					height: 220rpx;
					margin: 0 auto;
					border-radius: 20rpx;
					overflow: hidden;
					position: relative;

					image {
						width: 100%;
						height: 100%;
						display: block;
						background-color: #f9cd98;
					}

					.sex {
						position: absolute;
						top: 10rpx;
						right: 10rpx;
					}
				}

				.info {
					width: 90%;
					margin: 0 auto;
					padding: 20rpx 0 4rpx;

					.title {
						color: #080403;
						font-size: 28rpx;
						font-weight: bold;
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;
					}

					.box {
						display: flex;
						align-items: center;
						justify-content: space-between;
						padding-top: 10rpx;

						.text {
							font-size: 24rpx;
							color: #999;
						}

						.year {
							background-color: #ed781b;
							color: #fff;
							font-size: 26rpx;
							border-radius: 100rpx;
							padding: 4rpx 10rpx;
							zoom: 0.7;
						}
					}
				}
			}

			

			.add {
				height: 328rpx;

				.cat {
					width: 100%;
					height: 100%;
					display: flex;
					align-items: center;
					justify-content: center;
					flex-direction: column;

					span {
						color: #ed781b;
						padding-top: 10rpx;
						font-size: 28rpx;
					}
				}
			}
			.petOne{
				width: 88%;
			}
		}
	}
</style>
